#include<iostream>
using namespace std;
const int N=100010<<2;
struct node
{
    int l,r,sum;
}tr[N];
int n,q;
int a[N];
inline void renew(int id)
{
    tr[id].sum=tr[id<<1].sum+tr[id<<1|1].sum;
}
inline void build(int l,int r,int id)
{
    tr[id].l=l,tr[id].r=r;
    if(l>=r){tr[id].sum=a[l];return;}
    int mid=l+r>>1;
    build(l,mid,id<<1);
    build(mid+1,r,id<<1|1);
    renew(id);
}
inline void inst(int now,int plc,int val)
{
    if(tr[now].l==tr[now].r){tr[now].sum=now;return;}
    int mid=tr[now].l+tr[now].r>>1;
    if(plc<=mid)inst(now<<1,plc,val);
    else inst(now<<1|1,plc,val);
    renew(now);
}
inline int query(int now,int l,int r)
{
    int ret=0;
    cout<<now<<endl;
    if(tr[now].l>=l&&tr[now].r<=r)return tr[now].sum;
    int mid=tr[now].l+tr[now].r>>1;
    if(mid>=l)ret+=query(now<<1,l,r);
    if(mid+1<=r)ret+=query(now<<1|1,l,r);
    return ret;
}
int main()
{
    cin>>n>>q;
    for(int i=1;i<=n;i++)scanf("%d",&a[i]);
    build(1,n,1);
    int op,x,y;
    while(q--)
    {
        scanf("%d%d",&op,&x,&y);
        if(op==1)inst(1,x,y);
        else printf("%d\n",query(1,x,y));
    }
    return 0;
}
